home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PPC1B3AA.ZIP / PRSCRMBL.PPS < prev    next >
Text File  |  1996-08-29  |  3KB  |  85 lines

  1. ;----------------------------------------------------------------------------
  2. ; Copyright(C) 1996, The AEGiS Corporation
  3. ;----------------------------------------------------------------------------
  4. ;
  5. ; PROCEDURE PrintScramble()
  6. ;
  7. ; This procedure writes a string with a random scramble effect
  8. ;
  9. ; Warning : This procedure NEEDS to find spaces where the string will be
  10. ; printed... if not, a endless loop will occur...
  11. ; To ensure that everything is ok, you should add a CLS before or someting
  12. ; like :
  13. ;       Print Space(len(Str))
  14. ;       Backup len(Str)
  15. ;----------------------------------------------------------------------------
  16. #lib
  17. #nouser
  18.  
  19. Declare Procedure PrintScramble(String Str)
  20. Declare Procedure PS_RemCursor()
  21. Declare Procedure PS_Synchronize()
  22. Boolean PS_NoRemCursor
  23. Boolean PS_NoSynchro
  24.  
  25. ;----------------------------------------------------------------------------
  26. Procedure PrintScramble(String Str)
  27.  
  28. Integer v_int1, v_int2, v_int3, v_int4, v_int5, v_int6, v_int7
  29. String v_str1
  30.  
  31.  
  32. v_int4 = getx()     ; backup position
  33. v_int5 = gety()     ;
  34. v_int7 = curcolor() ; backup color
  35.  
  36. v_int2 = len(Str) ; length of string -> v_int2
  37.  
  38. While (1) Do
  39.     v_int1 = random(v_int2-1)+1 ; we randomly generate a number depending on
  40.                                 ; v_int2 (witch begins with the string len)
  41.     v_int3 = 0
  42.     v_int6 = 0
  43.     While (1) do                ; do until v_int6 is not v_int1 (random number)
  44.         inc v_int3
  45.         v_str1 = ScrText(v_int4+v_int3-1,v_int5, 1, False)
  46.         if (v_str1 = " ") inc v_int6 ; if char pointed is a space, inc v_int6
  47.         if (v_int6 = v_int1) Break
  48.     Endwhile
  49.     AnsiPos v_int4+v_int3-1,v_int5 ; ok so we have now the nth space (n = random)
  50.     v_str1 = Mid(Str, v_int3, 1) 
  51.     if (v_str1 != " ") Then        ; if the char to print is a space, print 
  52.         Print v_str1               ; a char 255, if not, print it...
  53.     else
  54.         Print chr(255)
  55.     endif
  56.     dec v_int2                     ; dec v_int2 so we cannot go over the 
  57.     if (v_int2 = 0) Break          ; amount of spaces available
  58.     PS_RemCursor()                   ; remove cursor
  59.     Delay 1                        ; add some delay
  60.     PS_Synchronize()                  ; wait for other end
  61.     Color v_int7                   ; restore color
  62. Endwhile
  63.  
  64. EndProc
  65.  
  66. Procedure PS_RemCursor()
  67.  
  68. If (!PS_NoRemCursor) Then
  69.     AnsiPos 1,23
  70.     Color 0
  71.     Print " "
  72.     Backup 1
  73. Endif
  74.  
  75. EndProc
  76.  
  77. Procedure PS_Synchronize()
  78.  
  79. If (!PS_NoSynchro) Then
  80.     While (Outbytes() > 0) Do
  81.     EndWhile
  82. Endif
  83.  
  84. EndProc
  85.